package com.bitcola.security.me.util;

import com.bitcola.security.common.util.Snowflake;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
 * 订单 id 生成
 *
 *  @author wx
 * @create 2018-10-23 16:25
 **/
@Component
public class OrderIdUtil {

    private SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMdd");
    Snowflake snowflake=new Snowflake();

    @Autowired
    SequenceFactory sequenceFactory;

    /**
     * 生成带日期的13位订单
     * @param key 具体是啥订单 (充值,提现...)
     * @return
     */
    public String getId(String key){
        return snowflake.nextIdStr();
    }


}
